#include "homeformmodel.h"


HomeFormModel::HomeFormModel(QObject *parent) : QObject(parent)
{
    m_Sever = new SimData_TcpSever();
    connect(m_Sever, SIGNAL(client(QString, QHostAddress, int)), this, SLOT(client_terminal(QString, QHostAddress, int)));
}

void HomeFormModel::start()
{
    m_Sever->dataStart();
    qDebug() << "Data Transmission Start ";
}

void HomeFormModel::stop()
{
    m_Sever->dataStop();
    m_Terminal.clear();
    qDebug() << "Data Transmission Stop ";
}

void HomeFormModel::hz(int hz)
{
    m_Sever->hz(hz);
}

void HomeFormModel::client_terminal(QString n, QHostAddress address, int port){

 qDebug() << n << address.toString().remove("::ffff:") + "("+ port +")";
 m_Terminal.append(n + " :" + address.toString().remove("::ffff:"));
 emit terminal(m_Terminal);
}

